#!/store/anaconda3/bin/python
#Program:
#       用python读取文件，进行数据的可视化
#History
#2017/10/20     chen    
#-------------------------
import numpy as np    #导入对应的python包 
from scipy.sparse import *
import matplotlib.pyplot as plt
 
dirct = {}
def readfile(dirfile, filename):
    file = np.load(os.path.join(dirfile,filename))
    for name in file.keys():
        if len(name)<=2 and name != 'M':
            if max(file[name]['bin1']) >= max(file[name]['bin2']):
                x = max(file[name]['bin1']) + 1
            else:
                x = max(file[name]['bin2']) + 1
            dirct[name] = coo_matrix((file[name]['IF'],(file[name]['bin1'],file[name]['bin2'])),shape=(x,x)).toarray()
    return dirct 
